import { request } from '../request';
export interface EntNoStudySearchParams {
  planCourseId: string;
  cycleId?: string;
}
export interface noStudyListItem {
  allPersonNum?: number;
  courseId?: string;
  cycleId?: string;
  cycleTime?: string;
  endTime?: string;
  entId: string;
  entName: string;
  finishState?: number;
  finishTime?: string;
  name?: string;
  noStudyPersonNum: number;
  personName?: string;
  phone?: string;
  planCourseId: string;
  startTime?: string;
  streetId?: string;
  streetName?: string;
  studyPersonNum?: string;
  studyRatio?: string;
  title?: string;
  type?: string | number;
  No: number;
}

/**
 * @desc 分页查询企业计划未学习情况
 */
async function getEntNoStudyList({ cycleId, planCourseId }: EntNoStudySearchParams) {
  const { data } = await request<noStudyListItem[]>({
    url: '/safe/api/statistics/getNoStudyEntListById',
    params: {
      cycleId,
      planCourseId,
    },
    noAutoShowErrorMessage: true,
  });
  data.forEach((e, index) => {
    //编号
    e.No = index + 1;
  });
  return data;
}

/**
 * @desc 分页查询企业计划情况
 */
async function getEnttudyList({ cycleId, planCourseId }: EntNoStudySearchParams) {
  const { data } = await request<noStudyListItem[]>({
    url: '/safe/api/statistics/getEntListById',
    params: {
      cycleId,
      planCourseId,
    },
    noAutoShowErrorMessage: true,
  });
  data.forEach((e, index) => {
    //编号
    e.No = index + 1;
  });
  return data;
}
export { getEntNoStudyList, getEnttudyList };
